<?php
require_once("../../class2.php");
require_once(HEADERF);
		$user_id = USERID;
		$user_name = USERNAME;
require_once("./includes/require_all.php");

if ($_GET['MPmodul']!=true) { ramka("open"); }

function autosyses1($delimiter,$page) {
	$abeta= mysql_real_escape_string($page*$delimiter)-$delimiter;
	$autosys= mysql_query("SELECT * FROM cms_automessage1 WHERE message not like '%Assassin%' ORDER BY date DESC LIMIT $abeta,$delimiter");
	while($sys=mysql_fetch_array($autosys)){
		$date= months_inBG(date("j F : H:i", strtotime($sys['date'])));
		echo<<<HTML
			<div class='forumheader2' style='padding:0px; padding-left:10px; padding-top:4px;'><b>♟</b> $sys[message] <span class='smalltext' style='float:right; margin-right:5px;'>$date</span><div style='clear:both;'></div></div>
			
HTML;
	}
}

echo "<div id='result'>";
autosyses1($_GET['abeta'],$_GET['aalfa']);

	$rowss= mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM cms_automessage1"));
	$alphatotal= ceil($rowss[0]/$_GET['abeta']);
	$alphacurrent= $_GET['aalfa'];
	$delimiter= $_GET['abeta'];
	if ($_GET['MPmodul']==true) { $alphastart=1; $alphaend=20; if ($alphaend>$alphatotal) $alphaend=$alphatotal; }
	else {
		$alphastart= $alphacurrent-10; if ($alphastart<1) $alphastart=1;
		$alphaend= $alphacurrent+10; if ($alphaend>$alphatotal) $alphaend=$alphatotal;
	}
	echo "<div class='forumheader3'>";
		while ($alphastart<=$alphaend) {
			if ($alphastart==$alphacurrent) $addd="textGREY"; else $addd="textWHITE";
			if ($_GET['MPmodul']==true) {
				echo "<span onclick=\"$('#autosysmessages').load('translations/cms/autosysprime.php?MPmodul=".$_GET['MPmodul']."&abeta=$delimiter&aalfa=$alphastart'+' '+'#result');\" class='unselectable button $addd'>$alphastart</span>";
			}
			else {
				echo "<a href='autosysprime.php?abeta=$delimiter&aalfa=$alphastart' class='unselectable button $addd'>$alphastart</a>";
			} 
			$alphastart++;
		}
if ($_GET['MPmodul']==true) { echo "<a href='translations/cms/autosysprime.php?abeta=50&aalfa=1' class='unselectable button'>Всички</a>"; }
echo "</div></div>";

if ($_GET['MPmodul']!=true) { ramka("close"); }

require_once(FOOTERF);
?>